+2005-08-23 Øyvind Kolås <pippin@gimp.org>
+
+ * babl/babl-instance.h: babl_class_name is moved to babl-classes.h
+ * babl/babl-conversion.h: add a method to the conversion class for the
+ processing with registered functions.
+ * babl/babl-fish.c: Use above functions.
+
2005-08-23 Øyvind Kolås <pippin@gimp.org>
* babl/babl-memory.[ch]: added additonal sanity checking (only
2005-08-22 Øyvind Kolås <pippin@gimp.org>
* babl/babl-classes.h: (BabPixelFormat): only a single BablModel.
- * babl/babl-fish.h,
* babl/babl-pixel-format.h,
* tests/babl-html-dump.c: accomodate change.
}
}
+static void
+babl_conversion_linear_process (BablConversion *conversion,
+ void *source,
+ void *destination,
+ long n)
+{
+ conversion->function.linear (source, destination, n);
+}
+
+static void
+babl_conversion_planar_process (BablConversion *conversion,
+ BablImage *source,
+ BablImage *destination,
+ long n)
+{
+ conversion->function.planar (source->bands,
+ source->data,
+ source->pitch,
+ destination->bands,
+ destination->data,
+ destination->pitch,
+ n);
+}
+
+/* this is the place to insert usage instrumentation into babl */
+void
+babl_conversion_process (BablConversion *conversion,
+ void *source,
+ void *destination,
+ long n)
+{
+ assert (BABL_IS_BABL (conversion));
+
+ switch (BABL(conversion)->class_type)
+ {
+ case BABL_CONVERSION_TYPE:
+ babl_conversion_linear_process (conversion,
+ source,
+ destination,
+ n);
+ break;
+ case BABL_CONVERSION_MODEL_PLANAR:
+ assert (BABL_IS_BABL (source));
+ assert (BABL_IS_BABL (destination));
+
+ babl_conversion_planar_process ( conversion,
+ (BablImage*) source,
+ (BablImage*) destination,
+ n);
+ break;
+ default:
+ babl_log ("%s(%s, %p, %p, %li) unhandled conversion type: %s",
+ __FUNCTION__, conversion->instance.name, source, destination, n,
+ babl_class_name (conversion->instance.class_type));
+ break;
+ }
+
+}
+
BABL_CLASS_TEMPLATE (babl_conversion)
typedef int (*BablEachFunction) (Babl *entry,
void *data);
-const char *babl_class_name (BablClassType klass);
/* these defines are kept here to keep the typing needed in class
* headers to a minimum, only the ones overriding the basic api with